﻿//地图操作对象
//此处所说的鼠标事件都指鼠标在地图上的事件
function MapOper()
{
    //鼠标按下
    this.OperDown = {
        1001  : thisObj.ZoomIn_OnMouseDown,       //放大
        1002  : thisObj.ZoomOut_OnMouseDown,      //缩小
        1003  : thisObj.MapDrag_OnMouseDown,      //拖拽
        2001  : thisObj.PointSearch_OnMouseDown,  //点查询
        2002  : thisObj.RectSearch_OnMouseDown,   //拉框查询
        2003  : thisObj.CircSearch_OnMouseDown,   //圆查询
        2004  : thisObj.PolySearch_OnMouseDown,   //多边形查询
        20056 : window.BeeLinePener,
        20053 : thisObj.Lable_OnMouseDown,        //标注
        20052 : thisObj.Distance_OnMouseDown,     //距离量算
        20072 : thisObj.AreaMouseDown,            //面积计算
        3001  : thisObj.HideLayer_OnMouseDown,    //隐藏图层
        3003  : window.LinePener,                 //绘线(此出索引的是对象,注意,如果保存对象,则对象应实现OnMouseDown、OnMouseMove、OnMouseUp、OnMouseDbClk操作)
        3004  : window.PolyPener,                 //描绘多边形
        3005  : window.CircPener,                 //画圆
        3006  : window.RectPener,                 //拉框
        4001  : thisObj.Add3DPoint_OnMouseDown    //3d坐标入库
    }
    
    //鼠标移动
    this.OperMove = 
    {
        1001  : thisObj.ZoomIn_OnMouseMove,       //放大
        1002  : thisObj.ZoomOut_OnMouseMove,      //缩小
        1003  : thisObj.MapDrag_OnMouseMove,      //拖拽
        2001  : thisObj.PointSearch_OnMouseMove,  //点查询
        2002  : thisObj.RectSearch_OnMouseMove,   //拉框查询
        2003  : thisObj.CircSearch_OnMouseMove,   //圆查询
        2004  : thisObj.PolySearch_OnMouseMove,   //多边形查询
        20056 : window.BeeLinePener,
        20053 : thisObj.Lable_OnMouseMove,        //标注
        20052 : thisObj.Distance_OnMouseMove,     //距离量算
        20072 : thisObj.AreaMouseMov,            //面积计算
        3001  : thisObj.HideLayer_OnMouseMove,    //隐藏图层
        3003  : window.LinePener,                 //绘线
        3004  : window.PolyPener,                 //描绘多边形        3005  : window.CircPener,                 //画圆
        3006  : window.RectPener,                 //拉框
        
        4001  : thisObj.Add3DPoint_OnMouseMove    //3d坐标入库
    }
    
    //鼠标弹起
    this.OperUp = 
    {
        1001  : thisObj.ZoomIn_OnMouseUp,         //放大
        1002  : thisObj.ZoomOut_OnMouseUp,        //缩小
        1003  : thisObj.MapDrag_OnMouseUp,        //拖拽
        2001  : thisObj.PointSearch_OnMouseUp,    //点查询
        2002  : thisObj.RectSearch_OnMouseUp,     //拉框查询
        2003  : thisObj.CircSearch_OnMouseUp,     //圆查询
        2004  : thisObj.PolySearch_OnMouseUp,     //多边形查询
        20053 : thisObj.Lable_OnMouseUp,          //标注
        20052 : thisObj.Distance_OnMouseUp,       //距离量算
        20072 : thisObj.AreaMouse_OnMouseUp,      //面积计算
        3001  : thisObj.HideLayer_OnMouseUp,      //隐藏图层
        3003  : window.LinePener,                 //绘线
        3004  : window.PolyPener,                 //描绘多边形        3005  : window.CircPener,                 //画圆
        3006  : window.RectPener,                 //拉框
        
        4001  : thisObj.Add3DPoint_OnMouseUp      //3d坐标入库
    }
    
    //双击(有些操作不需要捕获此事件)
    this.OperDbClk = 
    {
        1003  : thisObj.DblClickMoveToCenter,
        2004  : thisObj.LayDbClick,
        20052 : thisObj.LayDbClick,
        20072 : thisObj.LayDbClick,
        3001  : thisObj.HideLayer_OnMouseMove,
        3003  : window.LinePener,
        3004  : window.PolyPener,                 //描绘多边形
        4001  : thisObj.Add3DPoint_OnMouseMove
    }
    
    this.OperCbResult = 
    {
        3003  : getLinePenLogic,
        3004  : getPolyPenLogic,
        3005  : getCircPenLogic,
        3006  : getRectPenLogic
    }
    
    this.Cb_Down   = null;   //鼠标按下的回调函数
    this.Cb_Move   = null;   //鼠标移动的回调函数
    this.Cb_Up     = null;   //鼠标弹起的回调函数
    this.Cb_DbClk  = null;   //鼠标双击的回调函数
    
    //用户自带参数 分别对应 Cb_Down、up、move、dbclk
    this.Down_Params  = null;
    this.Move_Params  = null;
    this.Up_Params    = null;
    this.DbClk_Params = null;
    
    this.ActiveTool = 1003;  //默认操作为拖拽地图
    //鼠标状态
    this.MouseState = {
        MouseDown  : 1,
        MouseMove  : 2,
        MouseUp    : 3,
        MouseDbClk : 4
    }
    
    //调用此方法，设置地图操作
    //可以传入适当的回调函数
    this.setOperator = function(cmd)
    {
        this.ActiveTool = cmd;
        if(arguments[1])
        {
            this.Cb_DbClk = arguments[1].Cb_DbClk ? arguments[1].Cb_DbClk : null;
            this.Cb_Down  = arguments[1].Cb_Down ? arguments[1].Cb_Down : null;
            this.Cb_Move  = arguments[1].Cb_Move ? arguments[1].Cb_Move : null;
            this.Cb_Up    = arguments[1].Cb_Up ? arguments[1].Cb_Up : null;
            
            this.Down_Params  = arguments[1].Down_Params  ? arguments[1].Down_Params  : null;
            this.Move_Params  = arguments[1].Move_Params  ? arguments[1].Move_Params  : null;
            this.Up_Params    = arguments[1].Up_Params    ? arguments[1].Up_Params    : null;
            this.DbClk_Params = arguments[1].DbClk_Params ? arguments[1].DbClk_Params : null;
        }
        else
        {
            //回调函数
            this.Cb_Down  = null;
            this.Cb_Move  = null;
            this.Cb_Up    = null;
            this.Cb_DbClk = null;
            
            //用户自带参数
            this.Down_Params  = null;
            this.Move_Params  = null;
            this.Up_Params    = null;
            this.DbClk_Params = null;
        }
    }
}
